<div class="pipeline">
    <div class="stages autocomplete">
        <div class="pipeline_counter">
            <h3 class='wrapped_word'><%= highlight(scope[:pipeline].getLabel().to_s, params[:q]) -%></h3>
        </div>
        <div class="pipeline_details">
            <div class="stage_graphic clear_float">
                <%= render :partial => "stage_bar.html.erb", :locals => {:scope => {:pipeline => scope[:pipeline], :disable_stage_bar_href => scope[:disable_stage_bar_href]}} %>
            </div>
            <table class="change">
                <% scope[:pipeline].getBuildCause().getMaterialRevisions().each do |materialRevision| %>
                    <% materialRevision.getModifications().each do |modification| %>
                        <% scope[:revision] = modification.getRevision()
                           if materialRevision.isDependencyMaterialRevision()
                             scope[:upstream_label] = materialRevision.getLatestModification().getPipelineLabel()
                           else
                             scope[:comment] = modification.getComment()
                             scope[:modified_by] = modification.getUserDisplayName()
                           end
                           if any_match?(params[:q], scope[:revision], scope[:upstream_label], scope[:comment], scope[:modified_by])
                        %>
                            <tr class="first">
                                <td class="label">Revision:</td>
                                <td><%= highlight(scope[:revision], params[:q]) %></td>
                            </tr>
                            <% if materialRevision.isDependencyMaterialRevision() %>
                                <tr>
                                    <td class="label">Comment:</td>
                                    <td><%= highlight(scope[:upstream_label], params[:q]) %></td>
                                </tr>
                            <% else %>
                                <tr>
                                    <td class="label">Comment:</td>
                                    <td class="comment"><%= highlight(render_comment(modification, scope[:pipeline].getName()), params[:q]) %></td>
                                </tr>
                                <tr>
                                    <td class="label">Modified&nbsp;by:</td>
                                    <td><%= highlight(scope[:modified_by], params[:q]) %> on <%= modification.getModifiedTime().to_long_display_date_time %></td>
                                </tr>
                            <% end %>
                            <tr>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                                <td>&nbsp;</td>
                            </tr>
                        <% end %>
                    <% end %>
                <% end %>
            </table>
        </div>
    </div>
</div>
